<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('自定义短信')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content" id="messagecenter">
        <form class="form-horizontal m" id="form-xiaoxi-add">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">短信内容</label>
                <div class="col-sm-8">
                    <textarea style="height: 400px" name="messagecontent" class="form-control" required v-model="messagecontent"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">接收号码(以,隔开)</label>
                <div class="col-sm-8">
                    <input class="form-control" name="phones" v-model="phones">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-12" style="text-align: center;margin-top: 20px">
                    <button type="button" class="btn btn-primary btn-rounded btn-lg" @click="sendmessage()"><i class="fa fa-check">发送短信</i></button>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var vm_messagecenter = new Vue({
            el: "#messagecenter",
            data: {
                messagecontent : '',
                phones : '',
            },
            created : function(){
                var _this = this;
            },
            methods: {

                sendmessage:function(){
                    var _this = this;

                    var jingfeipici_layer = layer.open({type:3});
                    $.post('/system/messagecenter/send_piliang', {
                        messagecontent : _this.messagecontent,
                        phones : _this.phones,
                        rdm : Math.random()
                    },function(ppData) {
                        layer.close(jingfeipici_layer);

                        if (ppData != null) {
                            if (ppData.result==1){
                                layer.open({
                                    time: 1000,
                                    btn: [],
                                    content: "发送成功!",
                                });

                                _this.messagecontent = "";
                                _this.phones = "";

                            }else{
                                layer.alert(ppData.message);
                            }
                        }
                    },"json");
                },
            },

        })
    </script>
</body>
</html>